(function(window){
	var Index_subject_detailCtrl = {
		data:{},
		init: function(data){
			this.bindEven();
			var h=$(window).height()-100;
			$(".detail_content").css("min-height",h);
			var introNav=$("#introNav").prop('outerHTML');
			//var introNav=$("#introNav").clone();
			 var introNav_width=$("#subject_detail_body").find("#introNav").width();
			$(window).scroll(function(){
				 var scrollTop=$(this).scrollTop();	
				 var subject_detail_body=$("#subject_detail_body").offset().top-100;
				 var l1=$(".navbar-fixed-top").next("#introNav").length;
				 var l2=$("#subject_detail_body").find("#introNav").length;
				 //alert(introNav_width);
				 var w=($(window).width()-introNav_width)/2;
				 if(scrollTop>subject_detail_body){ 
				  if(l1==0){
						 $("#introNav").remove();
						 $(introNav).insertAfter($(".navbar-fixed-top"));
						  $("#introNav").css("margin-left",w);
						  $("#introNav .stuck-right").show();
					 }
					  
				 }else{
					 if( l2==0){
						  $("#introNav").remove();
						  $("#introNav .stuck-right").hide();
						  $(introNav).prependTo($("#subject_detail_body"));
					 }
				 }
				 var nav= $("#introNav .nav").find('a');
				 $("#introNav").find('.order_amount').text($("#order_amount_text").text())
				 $.each(nav,function(i,_this){
					var id = $(_this).attr("_href");
					var h=$(id).offset().top-120;
					if(h < scrollTop){
						$(_this).parent().parent().find("li").removeClass('active');
						$(_this).parent().addClass('active');
					}
				 })
			})
        },
		show_lesson:function(){	
			CM.init("BoxEdu","Subject_lessonCtrl").show_lesson($(this))
		},
	
		 bindEven: function(){
            var bindings = [{
               // element:document,
                element:'.learnchapter h3',
                event:hiApp.device.click,
                handler:this.show_lesson
            }
			
			];
            bindEvents(bindings);
        },
    };
		
	window.BoxEdu_Index_subject_detailCtrl = Index_subject_detailCtrl;
						
})(window);